package hotciv.framework;

/** Defines the Observer role for a Game.
 * 
<#if type == "code">

<#include "/data/author.txt">
</#if>
 */
public interface GameObserver 
{

  /** invoked every time a unit moves or changes state in the world 
   * @param u the unit whose state changes
   * @param from the tile that the unit has moved from
   * @param to the tile that the unit has moved to
   * */
  public void unitMoved(Unit unit, Position from, Position to);
  
  /** invoked when a unit is destroyed.
   * @param u the destroyed unit
   * @param position the tile from which the unit disappeared
   */
  public void unitDestroyed(Unit unit, Position position);

  /** invoked when a unit is created.
   * @param u the created unit
   * @param position the tile at which the unit appears
   */
  public void unitCreated(Unit unit, Position position);
  
  /** invoked just after the game's end of turn is called
   * to signal the new "player in turn" and world age state.
   * @param nextPlayer the next player that may move units etc.
   * @param age the present age of the world
   */
  public void turnEnds(Player nextPlayer, int age);
  
  /** invoked whenever a city changes size or owner
   * @param city the city where the change occured
   * @param position of the city in the world
   */
  public void cityChanged(City city, Position position);

  /** invoked whenever a new city appears on the world
   * @param city the new city
   * @param position of the city in the world
   */
  public void cityCreated(City city, Position position);
  
  /** invoked whenever the user changes focus to another
   * tile (for inspecting the tile's unit and city
   * properties.)
   * @param position the position of the tile that is
   * now inspected/has focus.
   */
  public void tileFocusChanged(Position position);
}
